// Megamenu script with overlay
$(function () {
	
	$('ul.productNav').children('li').hoverIntent({
     over: showMenu, 
     timeout: 100, 
     out: hideMenu
	});
		function showMenu(){
			var docHeight = $(document).height();
			var docWidth = $(document).width();
			$(".stickyHeader").append("<div class='overlay'></div>");
			$(".overlay").css({
				"height": docHeight,
				"width": docWidth,
				"z-index": 110
			}).fadeIn(500);
			$('ul.productNav').find('.megamenu').stop(true,true).hide();
			$(this).children("a").addClass("active");
			$('.miniBasket').css({"z-index": 0})
			$(this).find('.megamenu').fadeIn(500).css({
				"z-index": 210
			});			
		}
		function hideMenu(){
		 	$('ul.productNav').find('.megamenu').stop(true, true).hide();
			$(this).children("a").removeClass("active");				
			$(this).find('.megamenu').fadeOut(500);
			$(".overlay").delay(1000).fadeOut(500).remove();
		}

});